package dk.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ReturnData.ResponseData;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import dk.beans.examlistsearchconfig;
import dk.mapper.examlistsearchconfigmapper;
import dk.services.TokenService;

@RestController

public class ExamListConfigController {
	@Autowired
	TokenService tokenservice;
	@Autowired
	examlistsearchconfigmapper examlistsearchconfigmapper;
	@RequestMapping("GetExamListSearchConfig")
	public ResponseData GetExamListSearchConfig(String token) {
		ResponseData data = new ResponseData();
		Integer id =  tokenservice.GetIdByToken(token);
		if(id>0) {
			//查询到有id则获取配置
			Wrapper<examlistsearchconfig> qw = new QueryWrapper<examlistsearchconfig>();
			List<examlistsearchconfig> ExamCongfigList = examlistsearchconfigmapper.selectList(qw);
			data.setCode(200);
			data.setMessage("exam配置信息拉取成功");
			data.setData(ExamCongfigList);
			return data;
		}
		data.setCode(201);
		data.setMessage("无法查询到配置,涉及非法访问");
		
		return data;
		
	}
}
